home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_lightspike.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  366 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_LightSpike.cog
  4. # Player is killed by spikes if he enters the light
  5. # [GGJ]
  6. #
  7. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9. symbols
  10.  
  11. message startup
  12. message entered
  13. message timer
  14. message arrived
  15. message touched
  16. message    sighted
  17. message    user0
  18. message    activated
  19. message exited
  20.  
  21. thing   spike0    
  22. thing   spike1    nolink
  23. thing   spike2
  24. thing   spike3    
  25. thing   spike4    nolink
  26. thing   spike5    nolink
  27. thing   spike6    nolink
  28. thing   spike7    nolink
  29.     
  30. thing   spike8
  31. thing   spike9     nolink
  32. thing   spike10    nolink
  33. thing   spike11
  34. thing   spike12
  35. thing   spike13    nolink
  36. thing   spike14    nolink
  37. thing   spike15    nolink
  38.  
  39. thing   player                local
  40. thing   sapito                                #skeleton still on the spikes
  41. thing    forrestal                            #pile of bones on floor
  42. thing    actor                local                    
  43. thing    arm
  44.          
  45. thing    familiarCam                            #main camera for cutscene
  46. thing    LTresetCam                            #Temporary camera to revert to player
  47. thing    handCam                                #Shot of hand sticking into shaft
  48. thing    kneelCam                            #Indy kneels
  49.  
  50. thing    shaftGhost                            #look target for actor to look at shaft
  51.  
  52. thing    LTactor                                #actor                    
  53. thing    LTcamTarget0                        #camera looks at this during main cutscene
  54. thing    handCamTarget                        #camera looks at this during hand shot
  55. thing    armGhost                            #arm moves to this
  56. thing    kneelGhost                            #where Indy kneels
  57.  
  58. template    tplActor=indy_sh_actor       local
  59.  
  60. keyframe    skewered=in_die_buckle.key                    local
  61. keyframe    kneel=0in_stand6.key                        local
  62. keyframe    kneelDown=0in_stand1_bd_6.key                   local
  63. keyframe    standUp=0in_stand6_bd_1.key                    local
  64. keyframe    open=0in_openhand.key                        local
  65.  
  66. sound        sndDie=tem_temspikes_up_kill_c.wav            local
  67. sound        helloSapito=pu02j02.wav                        local
  68. sound        familiar=pu02j01.wav                        local
  69. sound        sprung=tem_temspikes_activate_c.wav            local
  70. sound        musBoulder=mus_gen_eerie1.wav                local
  71. sound        retract=shs_ticking.wav                        local
  72.     
  73. float   moveSpeed=10.0        local
  74. float    retractTime=30.0    local
  75.  
  76. sector    trapSector
  77. sector  lightSector
  78. sector    SapitoSector      
  79.  
  80. sector    oldBoulder
  81.  
  82. int        numspikes=16        local
  83. int        victim                local
  84. int     i=0                    local
  85. int        triggered=0            local
  86. int        deadIndy            local
  87. int        impaled=0            local
  88. int        once=0                local
  89. int        out=0                local
  90. int        tempCam                local
  91. int        curCam                local
  92. int        seenOnce=0            local
  93. int        kneelTrack            local
  94. int        danger=0            local
  95. int        musOnce=0            local
  96.  
  97. flex    tempRotVel            local
  98. flex    playerSpot            local
  99. flex    spikes                local
  100.  
  101. float    playery=0            local
  102. float    playerx=0            local
  103. vector    playervec            local
  104.  
  105. surface    westFloor
  106.  
  107. end
  108.        
  109. # ========================================================================================
  110. code
  111.  
  112. startup:
  113. player = GetLocalPlayerThing();
  114. SetCollideType(sapito, 0);
  115. SetThingCollideSize(forrestal, 0.075);
  116. SetThingFlags(arm, 0x80000);
  117. PlayKey(arm, open, 1, 0x4, 0);
  118. return;
  119. # ........................................................................................
  120.  
  121. entered:
  122. if ((GetSenderRef() == oldBoulder) && (musOnce == 0))
  123. {
  124.     musOnce=1;
  125.     PlaySoundLocal(musBoulder, 1.0, 0.0, 0x0, 0);
  126. }
  127.  
  128. if (GetSenderRef() == lightSector)
  129. {
  130.     danger=1;
  131.     PrintInt(danger);
  132.         
  133.         if (triggered == 0)
  134.         {
  135.             call spikes;
  136.         }
  137. }
  138.  
  139. if ((GetSenderRef() == trapSector) && (once == 0))
  140. {
  141.     once = 1;
  142.     curCam = GetCurrentCamera();
  143.     StartCutscene(1);
  144.     
  145.     #Stop the player from moving and put him in a standing position
  146.     MakeMeStop();
  147.     DeselectWeaponWait(player);
  148.     
  149.     #jump the player forward to a ghost
  150.     #CopyOrientandPos(LTstartGhost, player);
  151.     
  152.     #Create an actor at the player's location and swap them out
  153.     #actor = CreateThing(tplActor, player);
  154.     CopyPlayerHolsters(player, LTactor);
  155.     CaptureThing(LTactor);
  156.     
  157.     SetThingFlags(player, 0x80000);
  158.     ResetThing(player);
  159.     ClearThingFlags(LTactor, 0x80000);
  160.  
  161.     #Look from Indy to the pile of bones on the floor.
  162.     SetCameraFocus (2, familiarCam);
  163.     SetCameraLookInterp(2, 0);
  164.     SetCameraSecondaryFocus(2, LTcamTarget0);
  165.     SetCurrentCamera(2);
  166.     SetCameraFOV(65, 0, 0.0);
  167.     Sleep(0.3);
  168.     SetCameraLookInterp(2, 1);
  169.     SetCameraInterpSpeed(2, 3.5);
  170.     Sleep(0.3);
  171.     MoveToFrame(LTcamTarget0, 1, 1.0);
  172.     MoveToFrame(familiarCam, 1, 1.5);
  173.     SetCameraFOV(90, 1, 3.25);
  174.     Sleep(0.1);
  175.     #SetCameraSecondaryFocus(2, forrestal);
  176.     
  177.     #Turn actor to look at the shaft
  178.     tempRotVel=VectorLen(GetThingRotVel(ltactor));
  179.     SetThingMaxRotVel(ltactor, 20.0);
  180.     AISetLookThing(ltactor, shaftGhost);
  181.     Sleep(0.5);
  182.     
  183.     #"This trap looks familiar..."
  184.     PlayVoice(ltactor, familiar, 1, 0);
  185.     Sleep(1.5);
  186.     AISetLookThing(ltactor, forrestal);
  187.     Sleep(4.0);
  188.     
  189.     #Return player control
  190.     CopyOrientandPos(ltactor, player);
  191.     SetThingFlags(ltactor, 0x80000);
  192.     SetThingMaxRotVel(ltactor, tempRotVel);
  193.     ClearThingFlags(player, 0x80000);
  194.     ClearActorFlags(player, 0x200000);
  195.     ResetCameraFOV(0, 0.0);
  196.     SetCameraLookInterp(2, 0);
  197.     
  198.     tempCam = GetThingPos(LTresetCam);
  199.     SetCameraPosition(curcam, tempCam);
  200.     SetCurrentCamera(curcam);
  201.     EndCutscene();
  202. }
  203. return;
  204.  
  205. # ........................................................................................
  206. activated:
  207. #if ((GetSenderRef() == forrestal) && (GetThingSector(player) == trapSector))
  208.     print("activated floor");
  209.     playervec = GetThingLVec(player);
  210.     playery = VectorY(playervec);
  211.     playerx = VectorX(playervec);
  212.     
  213. #Check that Indy is on the west side, facing east.
  214. if ((seenOnce == 0) && (GetSenderRef() == WestFloor) && 
  215.     ((playerx > 0) && ((playery > -0.7) && (playery < 0.7))))
  216. {
  217.     #seenOnce=1;
  218.     curCam=GetCurrentCamera();
  219.     MakeMeStop();
  220.     DeselectWeaponWait(player);
  221.     StartCutscene(1);
  222.     
  223.     actor = CreateThing(tplActor, kneelGhost);
  224.     
  225.     SetCameraFocus(2, kneelCam);
  226.     SetCameraSecondaryFocus(2, arm);
  227.     SetCurrentCamera(2);
  228.     SetCameraFOV(50, 0, 0.0);
  229.     
  230.     CopyPlayerHolsters(player, actor);
  231.     CaptureThing(actor);
  232.     SetThingFlags(player, 0x80000);
  233.     ClearThingFlags(actor, 0x80000);
  234.     CopyOrientandPos(actor, player);
  235.     
  236.     PlayKey(actor, kneelDown, 2, 0x12, 1);
  237.     
  238.     kneelTrack = PlayKey(actor, kneel, 2, 0x14, 0);
  239.     
  240.     Sleep(0.75);
  241.     
  242.     SetCameraFocus(2, handCam);
  243.     SetCameraLookInterp(2, 0);
  244.     SetCameraSecondaryFocus(2, handCamTarget);
  245.     SetCurrentCamera(2);
  246.     SetCameraFOV(30, 0, 0.0);
  247.     Sleep(0.5);
  248.     
  249.     ClearThingFlags(arm, 0x80000);
  250.     AISetMoveThing(arm, armGhost, 0.5);
  251.     Sleep(0.5);
  252.     SetThingFlags(arm, 0x80000);
  253.     SetCurrentCamera(curCam);
  254.     ResetCameraFOV(0, 0.0);
  255.     
  256.     StopKey(actor, kneelTrack, 0.0); # no longer kneeling
  257.     PlayKey(actor, standUp, 2, 0x12, 0); # indy stands up
  258.     
  259.     call spikes;
  260.     
  261.     AISetLookThing(actor, Sapito);
  262.     Sleep(4.0);
  263.     
  264.     CopyOrientandPos(actor, player);
  265.     ClearThingFlags(player, 0x80000);
  266.     ClearActorFlags(player, 0x200000);
  267.     SetThingFlags(actor, 0x80000);
  268.     EndCutscene();
  269. }
  270. return;
  271.  
  272. # ........................................................................................
  273.  
  274. timer:
  275.     for (i = 0; i < numspikes; i = i + 1)
  276.     { 
  277.         MoveToFrame(spike0[i], 0, moveSpeed * 0.10);
  278.         MoveToFrame(sapito, 0, moveSpeed * 0.10);
  279.         PlaySoundThing(retract, spike0, 0.5, -1.0, -1.0, 0x0);
  280.         out = 0;
  281.     }    
  282.     return;
  283. # ........................................................................................    
  284. arrived:
  285.     print("arrived");
  286.     printInt(GetCurFrame(spike0));
  287.     if ((GetSenderRef() == spike0) && (GetCurFrame(spike0) == 0))
  288.     {
  289.         Sleep(0.5);
  290.         triggered = 0;
  291.         Print("Triggered=");
  292.         PrintInt(triggered);
  293.     }
  294.     return;
  295. # ........................................................................................        
  296. touched:
  297.     if (impaled) return;
  298.     Print("touched");
  299. #    if (GetSenderRef() == skelton0) return;
  300. #    if ((IsMoving(spike0)) && (triggered == 1))
  301. #    {
  302. #        impaled=1;
  303. #        DamageThing(player, 1000.0, 0x1, victim);
  304. #        PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  305. #        SetThingFlags(player, 0x80000);
  306. #        deadIndy = CreateThing(tplActor, player);
  307. #        CaptureThing(deadIndy);
  308. #        ClearThingFlags(deadindy, 0x80000);
  309. #        PlayKey(deadindy, skewered, 4, 0x14, 0);
  310. #    }
  311.     return;
  312.  
  313. # ........................................................................................
  314. sighted:
  315.     if ((GetSenderRef() == SapitoSector) && (impaled == 0) && (seenOnce == 0) && (out == 1))
  316.     {
  317.         seenOnce = 1;
  318.         Sleep(1.0);
  319.         PlayVoice(player, helloSapito, 1, 1);
  320.     }
  321.     return;
  322. # ........................................................................................
  323. exited:
  324.     if ((GetSenderRef() == lightSector) && (GetSourceRef() == player))
  325.     {
  326.         danger=0;
  327.         PrintInt(danger);
  328.     }
  329.     return;
  330. # ........................................................................................
  331. spikes:
  332.  
  333. for (i = 0; i < numspikes; i = i + 1)
  334.     MoveToFrame(spike0[i], 1, moveSpeed);
  335. }
  336. PlaySoundThing(sprung, spike0, 0.75, -1.0, -1.0, 0x0);
  337. PlaySoundThing(sprung, spike8, 0.75, -1.0, -1.0, 0x0);
  338. Print("whatever");
  339. triggered = 1;
  340. MoveToFrame(sapito, 1, moveSpeed);
  341. SetTimer(10);
  342.  
  343. Sleep(0.25);
  344. ClearSectorFlags(SapitoSector, 0x4000);
  345. out = 1;
  346.  
  347. if (danger == 1)
  348. {        
  349.     DamageThing(player, 1000.0, 0x1, victim);
  350.     PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  351.     SetThingFlags(player, 0x80000);
  352.     deadIndy = CreateThing(tplActor, player);
  353.     CaptureThing(deadIndy);
  354.     ClearThingFlags(deadindy, 0x80000);
  355.     PlayKey(deadindy, skewered, 4, 0x14, 0);
  356.     impaled=1;
  357. }
  358.  
  359.  
  360. return;    
  361.  
  362. # ........................................................................................
  363. end
  364.